package dk.aau.medialogy.y2013.p4;

import controlP5.ControlP5;
import controlP5.MultiList;
import controlP5.RadioButton;
import controlP5.Slider2D;
import ddf.minim.AudioInput;
import ddf.minim.AudioOutput;
import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
import ddf.minim.analysis.FFT;
import ddf.minim.ugens.Oscil;
import ddf.minim.ugens.Waves;

public class SystemManager
{
	// this class contains general fields/variables and functions

	// Minim fields
	public static Minim minim;
	public static AudioPlayer song;
	public static FFT fftSong, fftOscil, fftIn;
	public static ControlP5 cp5;
	public static Slider2D s;
	public static AudioOutput out;
	public static AudioInput in;
	//public static SineWave sine;


	public static MultiList l;
	public static MultiList l2;
	public static RadioButton r;

	// Window fields
	int slider = 400;
	public static final int HEIGHT = 720;
	public static final int WIDTH = HEIGHT * 16 / 10;
	public static final int MIDT_BOX_HEIGHT = HEIGHT * 10 / 100;
	public static final int WINDOW_HEIGHT = (HEIGHT - MIDT_BOX_HEIGHT) / 2;
	public static final int WINDOW_WIDTH = WIDTH * 75 / 100;
	public static final int NEXT_POW = upper_power_of_two(WINDOW_WIDTH);
	public static final int NUM_BUTTON = 10;
	public static final int BUTTON_SIZE = HEIGHT / NUM_BUTTON;
	public static final int MIDT_BUTTON_SIZE = MIDT_BOX_HEIGHT;
	public static final int ADDED_BAR = WIDTH * 95 / 100;

	public static int upper_power_of_two(int v)
	{
		v--;
		v |= v >> 1;
		v |= v >> 2;
		v |= v >> 4;
		v |= v >> 8;
		v |= v >> 16;
		v++;
		return v;

	}
}
